package avicit.bdp.dms.das.dto;

import avicit.bdp.common.base.BaseDTO;
import avicit.platform6.core.annotation.log.FieldRemark;
import avicit.platform6.core.annotation.log.Id;
import avicit.platform6.core.annotation.log.LogField;
import avicit.platform6.core.properties.PlatformConstant;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.lang3.StringUtils;

import javax.persistence.Column;
import javax.persistence.Table;

/**
 * @金航数码科技有限责任公司
 * @作者：developer
 * @邮箱：developer@avic-digital.com
 * @创建时间： 2020-06-24 14:54
 * @类说明：bdp_das_link
 * @修改记录：
 */
@ApiModel(value = "BdpDasLinkDTO", description = "bdp_das_link")
@Table(name = "bdp_das_link")
public class BdpDasLinkDTO extends BaseDTO {
    private static final long serialVersionUID = 1L;

    /**
     * id
     */
    @Id
    @LogField
    @ApiModelProperty(value = "id", name = "id")
    @FieldRemark(column = "id", field = "id", name = "主键")
    @javax.persistence.Id
    @Column(name = "id")
    private String id;

    /**
     * 源表ID
     */
    @LogField
    @ApiModelProperty(value = "源表ID", name = "sourceTableId")
    @FieldRemark(column = "source_table_id", field = "sourceTableId", name = "源表ID")
    @Column(name = "source_table_id")
    private String sourceTableId;

    /**
     * 目标表ID
     */
    @LogField
    @ApiModelProperty(value = "目标表ID", name = "targetTableId")
    @FieldRemark(column = "target_table_id", field = "targetTableId", name = "目标表ID")
    @Column(name = "target_table_id")
    private String targetTableId;

    /**
     * 源字段ID
     */
    @LogField
    @ApiModelProperty(value = "源字段ID", name = "sourceColumnId")
    @FieldRemark(column = "source_column_id", field = "sourceColumnId", name = "源字段ID")
    @Column(name = "source_column_id")
    private String sourceColumnId;

    /**
     * 目标字段ID
     */
    @LogField
    @ApiModelProperty(value = "目标字段ID", name = "targetColumnId")
    @FieldRemark(column = "target_column_id", field = "targetColumnId", name = "目标字段ID")
    @Column(name = "target_column_id")
    private String targetColumnId;

    /**
     * 线源X
     */
    @LogField
    @ApiModelProperty(value = "线源X", name = "sourceX")
    @FieldRemark(column = "source_x", field = "sourceX", name = "线源X")
    @Column(name = "source_x")
    private Integer sourceX;

    /**
     * 线源Y
     */
    @LogField
    @ApiModelProperty(value = "线源Y", name = "sourceY")
    @FieldRemark(column = "source_y", field = "sourceY", name = "线源Y")
    @Column(name = "source_y")
    private Integer sourceY;

    /**
     * 线目标X
     */
    @LogField
    @ApiModelProperty(value = "线目标X", name = "targetX")
    @FieldRemark(column = "target_x", field = "targetX", name = "线目标X")
    @Column(name = "target_x")
    private Integer targetX;

    /**
     * 线目标Y
     */
    @LogField
    @ApiModelProperty(value = "线目标Y", name = "targetY")
    @FieldRemark(column = "target_y", field = "targetY", name = "线目标Y")
    @Column(name = "target_y")
    private Integer targetY;

    /**
     * 源字段间关系
     */
    @LogField
    @ApiModelProperty(value = "源字段间关系", name = "targetRelation")
    @FieldRemark(column = "target_relation", field = "targetRelation", name = "源字段间关系")
    @Column(name = "target_relation")
    private String targetRelation;

    /**
     * 目标字段间关系
     */
    @LogField
    @ApiModelProperty(value = "目标字段间关系", name = "sourceRelation")
    @FieldRemark(column = "source_relation", field = "sourceRelation", name = "目标字段间关系")
    @Column(name = "source_relation")
    private String sourceRelation;

    public String getTargetRelation() {
        return targetRelation;
    }

    public void setTargetRelation(String targetRelation) {
        this.targetRelation = targetRelation;
    }

    public String getSourceRelation() {
        return sourceRelation;
    }

    public void setSourceRelation(String sourceRelation) {
        this.sourceRelation = sourceRelation;
    }

    /**
     * 线类型
     */
    @LogField
    @ApiModelProperty(value = "线类型", name = "lineType")
    @FieldRemark(column = "line_type", field = "lineType", name = "线类型")
    @Column(name = "line_type")
    private String lineType;


    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getSourceTableId() {
        return sourceTableId;
    }

    public void setSourceTableId(String sourceTableId) {
        this.sourceTableId = sourceTableId;
    }

    public String getTargetTableId() {
        return targetTableId;
    }

    public void setTargetTableId(String targetTableId) {
        this.targetTableId = targetTableId;
    }

    public String getSourceColumnId() {
        return sourceColumnId;
    }

    public void setSourceColumnId(String sourceColumnId) {
        this.sourceColumnId = sourceColumnId;
    }

    public String getTargetColumnId() {
        return targetColumnId;
    }

    public void setTargetColumnId(String targetColumnId) {
        this.targetColumnId = targetColumnId;
    }

    public Integer getSourceX() {
        return sourceX;
    }

    public void setSourceX(Integer sourceX) {
        this.sourceX = sourceX;
    }

    public Integer getSourceY() {
        return sourceY;
    }

    public void setSourceY(Integer sourceY) {
        this.sourceY = sourceY;
    }

    public Integer getTargetX() {
        return targetX;
    }

    public void setTargetX(Integer targetX) {
        this.targetX = targetX;
    }

    public Integer getTargetY() {
        return targetY;
    }

    public void setTargetY(Integer targetY) {
        this.targetY = targetY;
    }

    public String getLineType() {
        return lineType;
    }

    public void setLineType(String lineType) {
        this.lineType = lineType;
    }


    public String getLogFormName() {
        if (StringUtils.isEmpty(super.logFormName)) {
            return "数据模型模块";
        } else {
            return super.logFormName;
        }
    }

    public String getLogTitle() {
        if (StringUtils.isEmpty(super.logTitle)) {
            return "数据模型连线";
        } else {
            return super.logTitle;
        }
    }

    public PlatformConstant.LogType getLogType() {
        if (super.logType == null) {
            return PlatformConstant.LogType.module_operate;
        } else {
            return super.logType;
        }
    }

}
